﻿using System;

namespace IupNET
{
    public class MessageDlg:IupBase
    {
        public MessageDlg()
            : base(Iupc.MessageDlg())
        {

        }

        public MessageDlg(Dialog parent, string title, string message, MessageDialogType type, MessageDialogButtons buttons)
            : base(Iupc.MessageDlg())
        {
            Value = message;
            Title = title;
            DialogType = type;
            Buttons = buttons;
        }

        public int ButtonDefault
        {
            get
            {
                return Convert.StringToInt(GetAttribute("BUTTONDEFAULT"));
            }
            set
            {
                SetAttribute("BUTTONDEFAULT", value.ToString());
            }
        }

        public int ButtonResponse
        {
            get
            {
                return Convert.StringToInt(GetAttribute("BUTTONRESPONSE"));
            }
            set
            {
                SetAttribute("BUTTONRESPONSE", value.ToString());
            }
        }

        public MessageDialogButtons Buttons
        {
            get
            {
                return Convert.StringToMessageDialogButtons(GetAttribute("BUTTONS"));
            }
            set
            {
                SetAttribute("BUTTONS", Convert.MessageDialogButtonsToString(value));

            }
        }

        public MessageDialogType DialogType
        {
            get
            {
                return Convert.StringToMessageDialogType(GetAttribute("DIALOGTYPE"));
            }
            set
            {
                SetAttribute("DIALOGTYPE", Convert.MessageDialogTypeToString(value));

            }
        }

        public Dialog ParentDialog
        {
            get
            {
                return GetHandle(GetAttribute("PARENTDIALOG")) as Dialog;
            }

            set
            {
                SetAttribute("PARENTDIALOG", value.HandleName);
            }
        }


        public string Title
        {
            get
            {
                return GetAttribute("TITLE");
            }
            set
            {
                SetAttribute("TITLE", value);
            }
        }

        public string Value
        {
            get
            {
                return GetAttribute("VALUE");
            }
            set
            {
                SetAttribute("VALUE", value);
            }
        }

        public void Popup(int x,int y)
        {
            Iupc.Popup(cobject, x, y);
        }

        public EventCallback HelpCB
        {
            get
            {
                return CBHandler.Fetch("HELP_CB");
            }
            set
            {
                CBHandler.Set("HELP_CB", value);
            }
        }

       
    }
}
